using System;

namespace Microsoft.PowerShell.CmdletManagement
{
    public enum PsSpecHistoryChangeType
    {
        Project,
        Noun,
        Cmdlet,
        CmdletParameter,
        ParameterSetEntry
    }

    public enum PsSpecHistoryChangeAction
    {
        Add,
        Change,
        Remove
    }

    /// <summary>
    /// A class that represents an item in the spec history
    /// </summary>
    public class PsSpecHistoryEntry
    {
        public PsSpecHistoryEntry() { }

        public PsSpecHistoryEntry(int specHistoryId, string changeType,
            DateTime lastUpdated, string changedBy, int projectId, string projectName,
            int cmdletId, string cmdletName, int parameterId, string parameterName,
            string action, string propertyName, string oldValue, string newValue,
            string notes)
        {
            this.specHistoryId = specHistoryId;
            this.changeType = 
                (PsSpecHistoryChangeType)Enum.Parse(typeof(PsSpecHistoryChangeType), changeType);
            this.lastUpdated = lastUpdated;
            this.changedBy = changedBy;
            this.projectId = projectId;
            this.projectName = projectName;
            this.cmdletId = cmdletId;
            this.cmdletName = cmdletName;
            this.parameterId = parameterId;
            this.parameterName = parameterName;
            this.action = (PsSpecHistoryChangeAction)Enum.Parse(typeof(PsSpecHistoryChangeAction), action);
            this.propertyName = propertyName;
            this.oldValue = oldValue;
            this.newValue = newValue;
            this.notes = notes;
        }

        public int Id
        {
            get { return specHistoryId; }
            set { specHistoryId = value; }
        }
        private int specHistoryId;

        public PsSpecHistoryChangeType ChangeType
        {
            get { return changeType; }
            set { changeType = value; }
        }
        private PsSpecHistoryChangeType changeType;

        public DateTime LastUpdated
        {
            get { return lastUpdated; }
            set { lastUpdated = value; }
        }
        private DateTime lastUpdated;

        public string ChangedBy
        {
            get { return changedBy; }
            set { changedBy = value; }
        }
        private string changedBy;

        public int ProjectId
        {
            get { return projectId; }
            set { projectId = value; }
        }
        private int projectId;

        public string ProjectName
        {
            get { return projectName; }
            set { projectName = value; }
        }
        private string projectName;

        public int CmdletId
        {
            get { return cmdletId; }
            set { cmdletId = value; }
        }
        private int cmdletId;

        public string CmdletName
        {
            get { return cmdletName; }
            set { cmdletName = value; }
        }
        private string cmdletName;

        public int ParameterId
        {
            get { return parameterId; }
            set { parameterId = value; }
        }
        private int parameterId;

        public string ParameterName
        {
            get { return parameterName; }
            set { parameterName = value; }
        }
        private string parameterName;

        public PsSpecHistoryChangeAction Action
        {
            get { return action; }
            set { action = value; }
        }
        private PsSpecHistoryChangeAction action;

        public string PropertyName
        {
            get { return propertyName; }
            set { propertyName = value; }
        }
        private string propertyName;

        public string OldValue
        {
            get { return oldValue; }
            set { oldValue = value; }
        }
        private string oldValue;

        public string NewValue
        {
            get { return newValue; }
            set { newValue = value; }
        }
        private string newValue;

        public string Notes
        {
            get { return notes; }
            set { notes = value; }
        }
        private string notes;
    }
}